﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;

public partial class HouseCompare2 : PageBase
{
    public List<Chenxin.Lib.House.Entity.House_BaseInfo> houseInfoList;

    protected void Page_Load(object sender, EventArgs e)
    {
        //从Cache中获取要对比房源的ID
        Dictionary<string, string> dicCompareHouse;

        //从Cache中获取要对比的房源ID
        Chenxin.Lib.Cache.CacheService cs = new Chenxin.Lib.Cache.CacheService(Chenxin.Lib.Cache.CacheConn.xCacheConn.HOUSE);
        //Cache要比较房屋的键值
        string strCacheKey = string.Format(Chenxin.Lib.Cache.CacheDataType.HOUSE_COMPAREHOUSES, CurrentUserInfo.UserId.ToString());
        //从Cache中查找
        dicCompareHouse = cs.GetObject(strCacheKey) as Dictionary<string, string>;

        if (dicCompareHouse !=null)
        {
            //有比较房源数据
            if (dicCompareHouse.Keys.Count > 0)
            {
                StringBuilder strWhere = new StringBuilder();
                strWhere.Append(" HouseId  IN (");
                //循环查找
                foreach (KeyValuePair<string, string> curHouse in dicCompareHouse)
                {
                    strWhere.Append(",");
                    strWhere.Append("'" + curHouse.Value + "'");
                }
                strWhere.Append(" ) ");
                strWhere.Remove(14, 1);
                //取得对比房源的信息
                houseInfoList = Chenxin.Lib.House.BLL.House_BaseInfo.GetHouseInfoList(strWhere.ToString());
            }
        }
    }
}
